#include<bits/stdc++.h>
using namespace std;
const int N=2010;
int n,m,q,s[N][N],s1[N][N],t[N][N];
char a[N][N];
int main(){
	freopen("unicom.in","r",stdin);
	freopen("unicom.out","w",stdout);
	ios::sync_with_stdio(0);
	cin.tie(0);cin>>n>>m>>q;
	for(int i=1;i<=n;i++)cin>>(a[i]+1);
	for(int i=1;i<=n;i++) {
		for(int j=1,g=0,h=0;j<=m;j++){
			g+=max(0,(a[i][j]=='1')-(a[i][j-1]=='1')),h+=(a[i][j]=='1'&&a[i-1][j]=='1');
			s[i][j]=s[i-1][j]+g,s1[i][j]=s1[i-1][j]+h;
			t[j][i]=t[j][i-1]+(a[i][j]=='1'&&a[i][j-1]=='1');
		}
	}for(int x,y,xx,yy;q;q--){
		cin>>x>>y>>xx>>yy;
		cout<<s[xx][yy]-s[x-1][yy]-s[xx][y-1]+s[x-1][y-1]+t[y][xx]
		-t[y][x-1]-s1[xx][yy]+s1[x][yy]+s1[xx][y-1]-s1[x][y-1]<<"\n"; 
	}return 0;
}
